package com.ruoyi.system.rpc;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.domain.SysRole;
import com.ruoyi.system.service.ISysRoleService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/rpc/role")
public class SysRoleRpc {

    @Resource
    private ISysRoleService roleService;

    @GetMapping("/list")
    public R<List<SysRole>> list(SysRole role) {
        List<SysRole> list = roleService.selectRoleList(role);
        return R.ok(list);
    }

    @GetMapping(value = {"/{roleId}"})
    public R<SysRole> list(@PathVariable(value = "roleId") Long roleId) {
        SysRole role = roleService.selectRoleById(roleId);
        return R.ok(role);
    }
}
